package com.ruoyi.framework.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * @Author: wwy
 * @Date: 2020/12/29 13:33
 */
@Configuration
public class WebConfigurer implements WebMvcConfigurer{
    @Autowired
    private AppApiInterceptor appApiInterceptor;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // addPathPatterns("/**") 表示拦截所有的请求，
        // excludePathPatterns("/login", "/register") 表示除了登陆与注册之外，因为登陆注册不需要登陆也可以访问
        registry.addInterceptor(appApiInterceptor).addPathPatterns("/api/**")
                .excludePathPatterns("/api/login/**","/api/faceThan","/api/getIdentityInformation"
                        ,"/api/saveInfo"
                        ,"/api/authenticationFileUpload"
                        ,"/api/fileUpload"
                        ,"/api/getPhone"
                        ,"/api/getUserTerms"
                        ,"/api/getPhoneVerification"
                        ,"/api/saveInfoNew");
    }
}
